package ch03.Shangji.factory;

import ch03.Shangji.dao.*;

public class ResultsFactory {

    public static CalculationDao getInstance(String key){
        switch (key) {
            case "+":
                return new AddDao();
            case "-":
                return new ReduceDao();
            case"*":
                return new RideDao();
            case"/":
                return new ExceptDao();
            default:
                throw new RuntimeException("运算失败");
        }
    }
}
